package com.taxsearch.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.io.File;

/**
 * @program: demo
 * @description: 定义静态资源路径
 * @author: Bruse Queen
 * @create: 2019-01-25 12:34
 **/
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        String file = registry.addResourceHandler("file:/springboot/");
        File file = new File("/springboot/");
        if(!file.exists()){
            file.mkdirs();
        }
        registry.addResourceHandler("/springboot/**").addResourceLocations("file:/springboot/");
    }
}
